package com.audible.library.view.backing;

import java.io.Serializable;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

/**
 * The class represents ratings and review submitted by the user for
 * a particular audio book.
 *
 * @author Jigar Shah
 * @version 0.1
 */
@Named
@SessionScoped
public class RateReview implements Serializable {

    private static final long serialVersionUID = 7608738889194664514L;

    public enum Stars {
        ZERO(0), ONE(1), TWO(2), THREE(3), FOUR(4), FIVE(5);

        private int rating;

        private Stars(int rating) {
            this.rating = rating;
        }

        private int getRating() {
            return rating;
        }
    }

    private Stars overall = Stars.ZERO;
    private Stars performance = Stars.ZERO;
    private Stars story = Stars.ZERO;

    public RateReview() {
    }
    
    public void setOverall(Stars rating) {
        overall = rating;
    }

    public Stars getOverall() {
        return overall;
    }

    /**
     * @return the performance
     */
    public Stars getPerformance() {
        return performance;
    }

    /**
     * @param performance the performance to set
     */
    public void setPerformance(Stars performance) {
        this.performance = performance;
    }

    /**
     * @return the story
     */
    public Stars getStory() {
        return story;
    }

    /**
     * @param story the story to set
     */
    public void setStory(Stars story) {
        this.story = story;
    }

    /** Testing purpose only */
    public static void main(String[] args) {
        RateReview rr = new RateReview();
        rr.setOverall(Stars.FIVE);
        System.out.println(rr.getOverall().getRating());
    }
}
